<template>
  <div class="app-container">
    <!-- 查询 -->
    <tl-list-search ref="search" :query-param="queryParam" @search="doQuery" :isDisplayDefaultSearch="false" v-if="isHeaderDisplay">
      <template slot="search">
        <el-form-item label="" label-width="1px">
          <el-select style="width:180px" v-model="createdepart" placeholder="请选择部门名称" filterable collapse-tags clearable multiple @change="doQueryConcatCreateDepart">
            <el-option v-for="item in codeModel.deptCommonCodeList" :key="item.code" :label="item.name" :value="item.code" />
          </el-select>
        </el-form-item>
        <el-form-item label="" label-width="1px">
          <el-input v-model="queryParam.qry_projectname" placeholder="项目名称或编号" @keyup.enter.native="doQuery"></el-input>
        </el-form-item>
        <el-form-item label="" label-width="1px">
          <el-select v-model="projectlevel" multiple placeholder="请选择项目级别" style="width:190px" @change="doQueryConcatProjectLevel">
            <el-option v-for="item in codeModel.projectlevelList" :key="item.code" :label="item.name" :value="item.code"> </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="" label-width="1px">
          <el-input v-model="queryParam.qry_projectmanager" style="width:120px" placeholder="工号或姓名" @keyup.enter.native="doQuery"> </el-input>
        </el-form-item>
        <el-form-item label-width="0">
          <el-switch v-model="finishproject" active-text="全部" active-value="1" inactive-text="进行中" inactive-value="0" @change="doQuery"> </el-switch>
        </el-form-item>
      </template>
      <template slot="button">
        <el-button type="primary" icon="el-icon-zoom-in" @click="openDeatailSearchDialog">详细查询</el-button>
      </template>
      <template slot="button">
        <el-button type="primary" icon="el-icon-zoom-in" @click="resetQuery">重置</el-button>
      </template>
    </tl-list-search>
    <!-- 工具栏 -->
    <tl-list-toolbar ref="toolbar" :refMainTable="$refs.mainTable" currentModuleTableCode="mpmProject/main" :startColumn="2" :isDisplayAdd="false" :isDisplayDeleteBatch="false" @exportExcel="doExportExcel" :isDisplayExport="false" @deleteBatch="doDeleteBatch" @refresh="doRefresh" @columnCustomize="doColumnCustomize" @displaySearch="doDisplaySearch" :disableDeleteBatch="selectedRowKeys.length <= 0">
      <template slot="left-btn">
        <el-button class="filter-item" type="primary" icon="el-icon-download" @click="doExportExcel" v-hasPermission="['sys:excel:export']">导出</el-button>
        <el-dropdown split-button type="primary">
          <i class="el-icon-edit"></i>
          统计相关
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item @click.native="openSummaryDialog('managerForm')">统计(按项目经理)</el-dropdown-item>
            <el-dropdown-item @click.native="openSummaryDialog('deptForm')">统计(按部门)</el-dropdown-item>
            <el-dropdown-item @click.native="openSummaryDialog('productLineForm')">统计(按产品线)</el-dropdown-item>
            <el-dropdown-item @click.native="openSummaryDialog('meetStatForm')">项目周会统计</el-dropdown-item>
            <el-dropdown-item @click.native="openSummaryDialog('threePhaseScore')">统计(评分细则三阶段自评)</el-dropdown-item>
            <el-dropdown-item @click.native="openSummaryDialog1('supervisionDetailForm')">督办单明细报表</el-dropdown-item>
            <el-dropdown-item @click.native="openSummaryDialog('fourpageForm')">项目信息报表</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
        <el-button class="filter-item" type="primary" @click.native="openChangeManager()" v-if="isCFOForThisProject">项目经理交接</el-button>
        <el-button class="filter-item" type="primary" @click.native="openAddDialog('projectAttack')">春季/秋季攻势历史数据处理</el-button>
        <el-button v-if="ifShowConfig" class="filter-item" type="primary" @click.native="openEditDialog('weekConfig')">周配置功能</el-button>
        <!-- <el-button type="primary" icon="el-icon-zoom-in" @click="openDeatailSearchDialog">详细查询</el-button>
                        <el-button type="primary" icon="el-icon-zoom-in" @click="resetQuery">重置</el-button> -->
      </template>
    </tl-list-toolbar>
    <div>
      <!-- 列表选择 -->
      <!-- <div class="table-alert-div" ref="selector">
        <el-alert type="success" :closable="false" class="tl-table-alert-info" effect="light">
          <template slot="title">
            已选择&nbsp;<a class="tl-table-alert-info-a1">{{ selectedRowKeys.length }}</a>项&nbsp;&nbsp;
            <a class="tl-table-alert-info-a2" @click="doClearSelected">全部清空</a>
          </template>
        </el-alert>
      </div> -->

      <!--表格渲染-->
      <el-table class="tl-table" highlight-current-row ref="mainTable" :row-style="tableRowStyle" :height="tableHeight" resizable-key="tableHeight" :resizable-refs="tableResizeRefs" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" @row-dblclick="doRowDbClick" row-key="id" border fit :row-class-name="doChangeRowClassName">
        <!-- <el-table-column type="selection" width="55px" fixed="left" :selectable="doDisableCheckBox"></el-table-column> -->
        <el-table-column type="index" label="序号" width="50px" align="center"></el-table-column>
        <el-table-column prop="deptname" label="部门" width="95px" sortable="custom" sort-by="deptname" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispdeptname" label="区域" width="150px" sortable="custom" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="projectname" label="项目名称" min-width="270px" sortable="custom" sort-by="projectname" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="projectcode" label="项目编号" width="150px" sortable="custom" sort-by="projectcode" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="chanceclue" label="来源编号" width="175px" sortable="custom" align="left" header-align="center" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <el-row v-for="(item, index) in scope.row.chanceclueList" :key="index">
              <div class="superviser" style="overflow:hidden;">
                {{ item }}
              </div>
            </el-row>
          </template>
        </el-table-column>
        <el-table-column prop="dispprojectlevel" label="项目级别" width="80px" sortable="custom" sort-by="projectlevel" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="participatemoney" label="项目金额(万元)" width="130px" sortable="custom" sort-by="participatemoney" align="right" header-align="center" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="projectmanager" label="项目经理" width="80px" sortable="custom" sort-by="projectmanager" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="owner" label="Owner" width="75px" sortable="custom" sort-by="owner" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="sponsor" label="Sponsor" width="75px" sortable="custom" sort-by="sponsor" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="target" label="项目目标" width="200px" sortable="custom" sort-by="target" align="left" header-align="left" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispproductrange" label="产品名称" width="300px" align="left" header-align="center" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <el-row v-for="(item, index) in scope.row.productrangelist" :key="index">
              <div style="overflow:hidden;">
                {{ item }}
              </div>
            </el-row>
          </template>
        </el-table-column>
        <el-table-column prop="disppurchasepattern" label="采购模式" width="100px" sortable="custom" sort-by="purchasepattern" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="demandbegindate" label="需求上报日期" width="105px" sortable="custom" sort-by="demandbegindate" align="center" header-align="center" :formatter="dateFormat" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="demandenddate" label="需求截止日期" width="105px" sortable="custom" sort-by="demandenddate" align="center" header-align="center" :formatter="dateFormat" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="bidbegindate" width="100px" label="挂网日期" sortable="custom" sort-by="bidbegindate" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dateFormat"></el-table-column>
        <el-table-column prop="bidenddate" width="100px" label="开标日期" sortable="custom" sort-by="bidenddate" align="center" header-align="center" :show-overflow-tooltip="true" :formatter="dateFormat"></el-table-column>
        <el-table-column prop="planenddate" label="计划结束日期" width="105px" sortable="custom" sort-by="planenddate" align="center" header-align="center" :formatter="dateFormat" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="finishdate" label="立项日期" width="105px" sortable="custom" sort-by="finishdate" align="center" header-align="center" :formatter="dateFormat" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="appointmentenddate" label="项目任命日期" width="105px" sortable="custom" sort-by="appointmentenddate" align="center" header-align="center" :formatter="dateFormat" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="designenddate" label="项目策划日期" width="105px" sortable="custom" sort-by="designenddate" align="center" header-align="center" :formatter="dateFormat" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispprojectstate" label="项目阶段" width="115px" sortable="custom" sort-by="projectstate" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="superviselist" width="180px" label="督办情况" align="left" header-align="center" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <div v-if="scope.row.superviselist !== '' && scope.row.superviselist !== undefined">
              <el-row v-for="(item, index) in scope.row.superviselist" :key="index">
                <div class="superviser" @click="openViewDialog('superviseeditForm', item.id)">
                  <span>{{ item.supervisecode }}</span>
                  <el-button class="superviserButton" :type="supervisecolor(item.displiststate)" size="mini" plain>{{ item.displiststate }}</el-button>
                </div>
              </el-row>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="dispprojectresult" label="项目结果" width="100px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="resulttime" label="结果公布日期" width="120px" align="center" header-align="center" :formatter="dateFormat" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="settlementmoney" label="结项金额(万元)" width="120px" align="right" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="reviewmeet" label="复盘会" width="100px" align="center" header-align="center" :formatter="dateFormat" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="actualenddate" label="结项日期" width="100px" align="center" header-align="center" :formatter="dateFormat" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="risknum" label="项目风险" width="100px" align="center" header-align="center" :show-overflow-tooltip="true">
          <template slot-scope="{}" slot="header">
            <span>项目风险</span>
            <el-popover title="" width="400" placement="top" trigger="hover">
              <span>未闭环风险数量/已审核的总风险数量</span>
              <span slot="reference"><i class="el-icon-info" style="color: #909399"></i></span>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="dispexistbidscore" label="是否存在评分细则" width="150px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispfirstbidscore" label="第一次自评" width="200px" align="left" header-align="center" :show-overflow-tooltip="true">
          <template slot-scope="{}" slot="header">
            <span>第一次自评</span>
            <el-popover title="第一次自评：" width="400" placement="top" trigger="hover">
              <span v-html="content1" style="white-space: pre-wrap"></span>
              <span slot="reference"><i class="el-icon-info" style="color: #909399"></i></span>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="dispsecondbidscore" label="第二次自评" width="200px" align="left" header-align="center" :show-overflow-tooltip="true">
          <template slot-scope="{}" slot="header">
            <span>第二次自评</span>
            <el-popover title="第二次自评：" width="400" placement="top" trigger="hover">
              <span v-html="content2" style="white-space: pre-wrap"></span>
              <span slot="reference"><i class="el-icon-info" style="color: #909399"></i></span>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="thirdbidscore" label="本次评标得分" width="200px" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="meetneed" label="周会应开" width="150px" align="center" header-align="center" :show-overflow-tooltip="true">
          <template slot-scope="{}" slot="header">
            <span>周会应开</span>
            <el-popover title="周会应开：" width="400" placement="top" trigger="hover">
              <span v-html="content3" style="white-space: pre-wrap"></span>
              <span slot="reference"><i class="el-icon-info" style="color: #909399"></i></span>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="meetactual" label="周会实开" width="120px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="noweekcount" label="未开周数" width="120px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="movetask" label="履约评价/运行绩效任务" width="200px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="visitnum" label="专家拜访数量" width="120px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="enablevisitnum" label="有效指导数量" width="120px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispuploaddocument" label="审查会文件是否上传" width="200px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="disphavenamelist" label="是否获取DMD决策链" width="200px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispintonamelist" label="是否进入DMD" width="120px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="disppmoprojecttype" label="项目类型" width="100px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="signinfo" label="标记" width="195px" align="left" header-align="center" :show-overflow-tooltip="false">
          <template slot-scope="scope">
            <el-tooltip class="item" effect="dark" placement="top">
              <div v-html="scope.row.signinfo" slot="content" style="white-space: pre-wrap"></div>
              <div style="white-space: nowrap;">{{scope.row.signinfo}}</div>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column label="" width="40px" v-slot="scope" fixed="right">
          <el-dropdown trigger="hover">
            <el-button type="text"><i class="iconfont icon-xiala"></i></el-button>
            <!-- <el-button type="text" icon="el-icon-s-operation" style="margin-left:10px">更多<i class="el-icon-arrow-down el-icon--right"></i></el-button> -->
            <el-dropdown-menu>
              <el-dropdown-item icon="el-icon-edit" @click.native="openHistoryEdit('historyEdit', scope.row)">处理项目类型历史数据</el-dropdown-item>
              <el-dropdown-item icon="el-icon-circle-check" @click.native="openSignDialog('mpmSign', scope.row)">标记</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-table-column>
      </el-table>
      <!-- 列表分页 -->
      <el-row class="pagebar" type="flex" ref="pager" align="bottom">
        <el-col :span="12" style="margin-bottom:5px;">
          <el-col style="background-color:#D80A1E;height: 20px;width:20px;margin-left:10px" :offset="0"> </el-col>
          <el-col class="projectStateContext" :offset="0">
            项目超期
          </el-col>
          <el-col style="background-color:#FF8C2E;height: 20px;width:20px" :offset="0"> </el-col>
          <el-col class="projectStateContext milepost" :offset="0">
            里程碑及任务超期
          </el-col>
          <el-col style="background-color:#0000FF;height: 20px;width:20px" :offset="0"> </el-col>
          <el-col class="projectStateContext" :offset="0">
            流程超期
          </el-col>
          <el-col style="background-color:#B8860B;height: 20px;width:20px" :offset="0"> </el-col>
          <el-col class="projectStateContext" :offset="0">
            任务超期
          </el-col>
        </el-col>
        <el-col :span="14">
          <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"> </el-pagination>
        </el-col>
      </el-row>
      <tl-edit ref="editForm" @refresh="doRefresh"></tl-edit>
      <history-edit ref="historyEdit" :codeList="codeModel" @refresh="doRefresh"></history-edit>
      <tl-supervise-edit ref="superviseeditForm"></tl-supervise-edit>
    </div>
    <index-for-query-comp ref="indexForQueryComp" :projectcode="projectcode"></index-for-query-comp>
    <tl-four-page-summary ref="fourpageForm" @refresh="doRefresh"></tl-four-page-summary>
    <tl-manager-summary ref="managerForm" @refresh="doRefresh" :sourceType="sourceType" :queryParams="queryParam"></tl-manager-summary>
    <tl-manager-summary ref="deptForm" @refresh="doRefresh" :sourceType="sourceType" :queryParams="queryParam"></tl-manager-summary>
    <tl-product-line-summary ref="productLineForm" :queryParams="queryParam" @refresh="doRefresh"></tl-product-line-summary>
    <tl-meet-stat ref="meetStatForm" @refresh="doRefresh"></tl-meet-stat>
    <tl-detail-search ref="detailSearch" :queryParams.sync="queryParam" :projectlevels.sync="projectlevel" :createDepart.sync="createdepart" :codeModel="codeModel" @upadateParam="updateParam" @loadData="loadData" @resetQueryParam="resetQueryForDetailSearch" :finishProject.sync="finishproject" :fromQueryPage="false"></tl-detail-search>
    <tl-mpm-project-change-manager ref="projectChangeManager"></tl-mpm-project-change-manager>
    <tl-project-attack ref="projectAttack" @refresh="doRefresh"></tl-project-attack>
    <tl-week-config ref="weekConfig"></tl-week-config>
    <tl-mpm-sign ref="mpmSign" @refresh="doRefresh"></tl-mpm-sign>
    <three-phase-score ref="threePhaseScore"></three-phase-score>
    <supervision-detail-form ref="supervisionDetailForm" @showFullScreen="showFullScreen('supervisionDetailForm')"></supervision-detail-form>
    <supervision-detail-form ref="fullScreenRef" :render="'el-dialog'"></supervision-detail-form>
  </div>
</template>

<script>
/** mixins */
import { mixin_list } from '@tapui/mixins/mixin_list'
/** 子组件 */
import { validateNull } from '@tapui/utils/validate'
import tlSuperviseEdit from '@/views/mpm/mpmProjectSupervise/editView'
import tlEdit from './edit'
import historyEdit from './historyEdit'
import tlManagerSummary from './managerSummary'
import tlProductLineSummary from './productLineSummary'
import tlDetailSearch from '@/views/mpm/mpmProject/DetailSearch'
import IndexForQueryComp from '../projectInfo/indexForQueryComp'
import tlMpmProjectChangeManager from '@/views/mpm/mpmProjectChangeManager/edit'
import tlProjectAttack from './editProjectAttack'
import tlWeekConfig from './editWeekConfig'
import tlMpmSign from '@/views/mpm/mpmSign/mpmSignIndex'
import tlMeetStat from './meetStat'
import ThreePhaseScore from '@/views/mpm/mpmProjectBidScore/statistic/ThreePhaseScore'
import supervisionDetailForm from './supervisionDetailForm'
import tlFourPageSummary from './fourPageSummary'
/** 工具类 */
import { getAction, putAction, postAction, deleteAction } from '@tapui/utils/http'
import { filterObjectNull, rmbFormat } from '@tapui/utils/util'
import HistoryEdit from './historyEdit.vue'
export default {
  name: 'mpmProject',
  mixins: [mixin_list],
  components: { tlWeekConfig, historyEdit, IndexForQueryComp, tlMpmProjectChangeManager, tlEdit, tlDetailSearch, tlSuperviseEdit, tlManagerSummary, tlProductLineSummary, tlProjectAttack, tlMeetStat, ThreePhaseScore, supervisionDetailForm, tlMpmSign, tlFourPageSummary },
  data() {
    return {
      sourceType: '',
      projectlevelList: [],
      description: '项目立项-列表查询',
      urlPrefix: '/mpm/projectpolymerization/',
      url: {
        list: '/mpm/projectpolymerization/projectQueryList',
        queryCodeList: '/mpm/projectpolymerization/dataCodeList',
        isCFO: '/mpm/project/isCFO',
        getProjectChangeManager: '/mpm/projectChangeManager/getProjectChangeManager',
        queryMeetInfo: '/mpm/project/queryMeetPerWeek'
      },
      detailSearchVisible: false,
      ifShowConfig: false,
      // 排序参数
      sorterInfo: {
        sidx: 'MpmProject.ABNORMALSTATE',
        sord: 'desc'
      },
      chanceclueList: [],
      urlParam: '?',
      projectlevel: [],
      createdepart: [],
      pickerOptions: {
        shortcuts: [
          {
            text: '本月',
            onClick(picker) {
              const date = new Date()
              const firstDay = new Date(date.getFullYear(), date.getMonth(), 1)
              picker.$emit('pick', [firstDay, new Date()])
            }
          },
          {
            text: '今年至今',
            onClick(picker) {
              const end = new Date()
              const start = new Date(new Date().getFullYear(), 0)
              picker.$emit('pick', [start, end])
            }
          },
          {
            text: '最近六个月',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              start.setMonth(start.getMonth() - 6)
              picker.$emit('pick', [start, end])
            }
          },
          {
            text: '最近一年',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              start.setMonth(start.getMonth() - 12)
              picker.$emit('pick', [start, end])
            }
          }
        ]
      },
      isCFOForThisProject: false,
      projectcode: '',
      finishproject: '0',
      content1: '1、已完成第一次自评将商务、技术得分展示到列表中；\n2、立项决策审批通过后，策划审批通过之前，未录入第一次自评，显示“待录入”；\n3、策划审批通过之后，挂网日期之前，未录入第一次自评，显示“超期”；\n4、挂网日期之后，未录入第一次自评，显示“未录入”；\n5、非招标项目，显示“/”。',
      content2: '1、已完成第二次自评将商务、技术得分展示到列表中；\n2、挂网日期之前，显示“未挂网”；\n3、挂网日期之后7天内（包含），未录入第二次自评，显示“待录入”；\n4、挂网日期之后7天后（不包含），开标日期之前，未录入第二次自评，显示“超期”；\n5、开标日期之后，未录入第二次自评，显示“未录入”；\n6、非招标项目，显示“/”。',
      content3: '1、统计起点：项目策划审批通过后下一周（例：本周审批通过，下个周开始统计周会召开）；\n2、统计终点：开标日期所在周的前一个周。'
    }
  },
  // 消除因页面跳转导致无法消失的tooltip
  deactivated() {
    const tooltip = document.querySelectorAll('.el-tooltip__popper')
    tooltip.forEach((item) => {
      item.style.display = 'none'
    })
  },
  methods: {
    // 打开全屏
    showFullScreen(refName) {
        this.fullScreenRefName = refName
        this.$refs.fullScreenRef.visible = true
        this.$refs.fullScreenRef.fullscreenState = true
        this.$refs.fullScreenRef.fullScreenButton = false
        this.$refs.fullScreenRef.queryParam.projectlevel = this.$refs.supervisionDetailForm.queryParam.projectlevel
        this.$refs.fullScreenRef.queryParam.deptcommoncode = this.$refs.supervisionDetailForm.queryParam.deptcommoncode
        if (this.$refs.supervisionDetailForm.queryParam.startDate !== null && this.$refs.supervisionDetailForm.queryParam.endDate !== null) {
          this.$refs.fullScreenRef.startandenddate.push(this.$refs.supervisionDetailForm.queryParam.startDate)
          this.$refs.fullScreenRef.startandenddate.push(this.$refs.supervisionDetailForm.queryParam.endDate)
        }
        this.$refs.fullScreenRef.queryParam.startDate = this.$refs.supervisionDetailForm.queryParam.startDate
        this.$refs.fullScreenRef.queryParam.endDate = this.$refs.supervisionDetailForm.queryParam.endDate
        this.$refs.fullScreenRef.pageInfo.currentPage = this.$refs.supervisionDetailForm.pageInfo.currentPage
        this.$nextTick(() => {
          this.$refs.fullScreenRef.loadData({ currentPage: this.$refs.supervisionDetailForm.pageInfo.currentPage })
        })
      },
    // 打开历史数据编辑页面
    openHistoryEdit(editForm, rowData) {
      this.$refs[editForm].projectData = rowData
      this.openEditDialog(editForm, rowData.id)
    },
    openDeatailSearchDialog() {
      this.$refs.detailSearch.visible = true
    },
    // 接受子组件返回参数
    updateParam(queryParam) {
      this.queryParam = queryParam
    },

    openSummaryDialog(Form) {
      this.$refs[Form].visible = true
      this.sourceType = Form
    },
    openSummaryDialog1(Form) {
      // this.$refs[Form].visible = true
      this.$refs[Form].openforNormal()
    },
    supervisecolor(e) {
      if (e === '超期' || e === '延期响应' || e === '未响应') {
        return 'warning'
      } else if (e === '按时响应' || e === '已完成') {
        return 'success'
      } else if (e === '进行中') {
        return 'primary'
      }
    },
    // 项目级别多选框
    doQueryConcatProjectLevel(data) {
      if (data.length > 0) {
        this.queryParam.qry_projectlevel = data
          .map((item) => {
            return "'" + item + "'"
          })
          .join(',')
      } else {
        this.queryParam.qry_projectlevel = null
      }
    },
    // 部门名称多选框
    doQueryConcatCreateDepart(data) {
      if (data.length > 0) {
        this.queryParam.qry_deptcommoncode = data
          .map((item) => {
            return "'" + item + "'"
          })
          .join(',')
      } else {
        this.queryParam.qry_deptcommoncode = null
      }
    },
    // 重置查询条件(子组件调用)
    resetQueryForDetailSearch() {
      this.queryParam = {}
      this.param = {}
      this.projectlevel = []
      this.createdepart = []
      this.doQuery()
    },
    // 重置查询条件(页面重置按钮使用)
    resetQuery() {
      this.queryParam = {}
      this.param = {}
      this.projectlevel = []
      this.createdepart = []
      this.$refs.detailSearch.resetQueryParam()
      this.doQuery()
    },
    /** 执行查询 */
    doQuery() {
      this.loadData({ currentPage: 1 })
    },
    /** 获取查询参数 */
    getQueryParams() {
      let param = {}
      if (this.$route.query.level !== undefined && this.$route.query.level !== null) {
        this.projectlevelList[0] = this.$route.query.level
      }
      if (this.$route.query.abnormalstate !== undefined && this.$route.query.abnormalstate !== null) {
        this.queryParam.qry_abnormalstate = this.$route.query.abnormalstate
      }
      if (this.$route.query.projectstate !== undefined && this.$route.query.projectstate !== null) {
        this.queryParam.qry_projectstate = this.$route.query.projectstate
      }
      if (this.projectlevelList) {
        param.qry_projectlevel = this.projectlevelList.join(',')
      }
      if (this.$route.query.dataPermission !== undefined && this.$route.query.dataPermission !== null) {
        this.queryParam.qry_dataPermission = this.$route.query.dataPermission
      }
      if (this.superQueryParams) {
        param['superQueryParams'] = encodeURI(this.superQueryParams)
      }
      if (this.urlParam.length !== 0) {
        this.urlParam = window.location.search
      }
      this.$set(this.queryParam, 'qry_finishproject', this.finishproject)
      Object.assign(param, this.queryParam, this.sorterInfo, this.filtersInfo)
      param.currentPage = this.pageInfo.currentPage
      param.pageSize = this.pageInfo.pageSize
      return filterObjectNull(param)
    },
    // 禁用表格前面的选择
    doDisableCheckBox(row, index) {
      if (row.state !== 0 && row.state !== 2) {
        return false
      } else {
        return true
      }
    },
    /** 列表数据加载开始 */
    loadData(paramMap) {
      // 得到加载分页
      if (validateNull(paramMap) === false && Object.keys(paramMap).indexOf('currentPage') > -1) {
        this.pageInfo.currentPage = paramMap['currentPage']
      }
      if (!this.beforeLoadData()) return
      // 查询条件
      var params = this.getQueryParams()
      // 数据查询
      this.loading = true
      getAction(this.url.list, params)
        .then((res) => {
          if (res.success) {
            res.result.dataList.forEach((element) => {
              if (element.chanceclue.indexOf(',') > 0) {
                // 如果有多个机会点，则换行展示
                let chancleArray = element.chanceclue.split(',')
                this.$set(element, 'chanceclueList', chancleArray)
              } else {
                let tArray = [element.chanceclue]
                this.$set(element, 'chanceclueList', tArray)
              }
            })
            this.datas = res.result.dataList
            this.pageInfo.totalCount = res.result.totalCount
            // 初始化自定义列
            if (typeof this.$refs.toolbar !== 'undefined') {
              this.$refs.toolbar.doInitTableColumn()
            }
            this.queryMeetInfo()
          } else {
            this.$tap.alert(res.message, 'warning')
          }
          this.afterLoadData()
          this.loading = false
        })
        .catch((err) => {
          this.loading = false
        })
    },
    // 行颜色
    tableRowStyle(row, index) {
      // 项目监管的列表，不管是项目超期、里程碑及任务超期、任务超期，只要项目是已结项的，全部置为无色
      if (row.row.projectstate === 2) {
        return {}
      } else {
        // 项目监管的列表，项目不是已结项的，根据abnormalstate显示对应颜色
        if (row.row.abnormalstate === 30) {
          return { 'background-color': '#D80A1E', color: '#FFFFFF' }
        } else if (row.row.abnormalstate === 20) {
          return { 'background-color': '#FF8C2E', color: '#FFFFFF' }
        } else if (row.row.abnormalstate === 10) {
          return { 'background-color': '#B8860B', color: '#FFFFFF' }
        } else if (row.row.abnormalstate === 15) {
          // 流程超期的项目异常状态字段为15
          return { 'background-color': '#0000FF', color: '#FFFFFF' }
        }
      }
    },
    // 双击打开项目追踪页面
    doRowDbClick(row, column, event) {
      // 如果项目立项未审批完成，双击跳转到立项页面
      if (row.state < 9) {
        this.openViewDialog('editForm', row.id)
      } else {
        this.projectcode = row.projectcode
        this.$nextTick(() => {
          this.$refs.indexForQueryComp.id = row.id
          this.$refs.indexForQueryComp.visible = true
        })
      }
    },
    openChangeManager() {
      this.openAddDialog('projectChangeManager')
    },
    isCFO() {
      const param = {
        usercode: this.user.code
      }
      getAction(this.url.isCFO, param).then((res) => {
        if (res.success) {
          if (res.result) {
            this.isCFOForThisProject = true
          }
        } else {
          this.$tap.alert('用户职位未获取成功，请联系管理员')
        }
      })
    },
    // 加载完毕后获取会议实开周会数量
    queryMeetInfo() {
      postAction(this.url.queryMeetInfo, this.datas).then((res) => {
        if (res.success) {
          res.result.forEach((item, index) => {
            this.$set(this.datas[index], 'meetactual', item.meetactual)
            this.$set(this.datas[index], 'reviewmeet', item.reviewmeet)
            if (item.hasOwnProperty("meetactualforactual") && this.datas[index].hasOwnProperty("meetneed")) {
              this.$set(this.datas[index], 'noweekcount', this.datas[index].meetneed - item.meetactualforactual)
            }
          })
        } else {
          // this.$tap.alert('获取会议信息失败，请联系管理员！', 'warning')
        }
      })
    },
    // 标记
    openSignDialog(editForm, row) {
      this.$refs[editForm].sourceid = row.id
      this.$refs[editForm].sourcetype = 'MpmProject'
      this.$refs[editForm].querySignInfo()
      this.$refs[editForm].visible = true
    }
  },
  created() {
    // 判断是否为省区财经副总
    this.isCFO()
    this.ifShowConfig = false
    // 判断周配置组件可用，目前只有刘元嵩
    let userCode = this.$store.getters.user.code
    // eslint-disable-next-line
    this.ifShowConfig = userCode === '0967' ? true : false
  }
}
</script>

<style scoped lang="scss">
/deep/ .el-table tbody tr.current-row > td {
  background: #ADD8E6 !important;
   .cell {
    color: #161112 !important;
  }
}
div.superviser:hover,
div.superviser:active {
  text-decoration: underline;
}
/deep/ .el-table__body .el-table__row.hover-row td {
  background-color: transparent !important;
}
/deep/ #searchDetailForm .el-form-item__content {
  width: 70%;
}
/deep/ #searchDetailForm .el-form-item {
  width: 100%;
}
.superviser {
  display: flex;
}
.superviserButton {
  margin-left: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 50px;
  height: 22px;
}
.filter-item {
  margin-left: 0;
}
</style>
